package com.common.util;

import java.util.HashMap;
import java.util.Map;

public class AjaxMessageUtil {

    public static final Object createErrorMessage(String message,Object obj){
        return createMessage(message,obj,0);
    }

    public static final Object createInfoMessage(String message,Object obj){
        return createMessage(message,obj,1);
    }
    public static final Object createSecurityInfoMessage(String message,String sign,Object obj){
        Map<String,Object> param = (Map<String, Object>) createMessage(message,obj,1);
        param.put("sign",sign);
        return param;
    }

    private static final Object createMessage(String message,Object obj,int state){
        Map<String,Object> param = new HashMap<>();
        param.put("state",state);
        param.put("data",obj);
        param.put("message",message);
        return param;
    }

}
